package com.example.demo.Config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class LoginInter implements WebMvcConfigurer {
   @Autowired
   public  LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")//拦截所有url地址
                .excludePathPatterns("/blog-login.html")
                .excludePathPatterns("/blog_detail.html")
                .excludePathPatterns("/blog_list.html")
                .excludePathPatterns("/blog_sign.html")
                .excludePathPatterns("/css/**")
                .excludePathPatterns("/editor.md/**")
                .excludePathPatterns("/js/**")
                .excludePathPatterns("/art/add")
                .excludePathPatterns("/user/sign")
                .excludePathPatterns("/user/login")
                .excludePathPatterns("/user/author")
                .excludePathPatterns("/user/islogin")
                .excludePathPatterns("/art/getDetail")
                .excludePathPatterns("/art/addRcount")
                .excludePathPatterns("/art/countArt")
                .excludePathPatterns("/art/sumArt")
                .excludePathPatterns("/art/pageLimt");
    }
}
